package com.xtravel.discovery.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.lidroid.xutils.BitmapUtils;
import java.util.List;
import com.xtravel.common.adapter.BaseDataAdapter;
import com.xtravel.discovery.dto.StateLiveRecord;
import com.xtravel.discovery.viewholder.BaseViewHolder;
import com.xtravel.discovery.viewholder.StateLiveRecordsViewHolder;

/**
 * Created by Memory on 15/11/4.
 */
public class StateLiveRecordsAdapter extends BaseDataAdapter<StateLiveRecord> {
    private Context context;
    private LayoutInflater layoutInflater;
    private BitmapUtils bitmapUtils;

    public StateLiveRecordsAdapter(Context context, List<StateLiveRecord> items, BitmapUtils bitmapUtils)
    {
        super(items);
        this.context = context;
        this.bitmapUtils = bitmapUtils;
        layoutInflater = LayoutInflater.from(this.context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        BaseViewHolder holder;
        if (convertView == null) {
            holder = new StateLiveRecordsViewHolder(this.context, this.bitmapUtils, this.layoutInflater);
            convertView = holder.getView();
        } else {
            holder = (BaseViewHolder) convertView.getTag();
        }

        StateLiveRecord record = getItem(position);
        holder.setValue(record);
        return convertView;
    }

    @Override
    public void getData(Object args) {

    }

    @Override
    public void updateData(List<StateLiveRecord> data) {
        this.dataList = data;
    }
}

